package org.de.maeyer.statistic;


/**
 * @author Peter De Maeyer
 */
public class CountAccumulator implements Accumulator {

	private long count;

	public CountAccumulator(long count) {
		this.count = count;
	}

	public CountAccumulator() {
		this(0L);
	}

	public void reset() {
		count = 0L;
	}

	@Override
    public void accumulate() {
	    count++;
    }

	@Override
    public void accumulateDouble(double value) {
		accumulate();
    }

	@Override
    public void accumulateLong(long value) {
		accumulate();
    }

	@Override
    public void accumulateObject(Object value) {
		accumulate();
    }
	
	@Override
	public void appendTo(StatisticsBuilder builder) {
	    builder.setCount(count);
	}
}
